package edu.uwosh.cs342.group1.storage;

import java.util.List;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.ElementListUnion;
import org.simpleframework.xml.Root;

@Root
public class Quiz {
	@Attribute
	private int id;
	@Attribute
	private String name;
	@ElementListUnion({
		@ElementList(entry="sa", inline=true,type=ShortAnswer.class),
		@ElementList(entry="mc", inline=true,type=MultipleChoice.class),
		@ElementList(entry="tf", inline=true,type=TrueFalse.class)
	})
	private List<Question> questions;
	
	/**
	 * Gets the id of the quiz
	 * @return
	 */
	public int getId() {
		return this.id;
	}
	
	/**
	 * Sets the id of the quiz
	 * @param id
	 */
	public void setId(int id) {
		this.id = id;
	}
	
	/**
	 * Gets the name of the quiz
	 * @return
	 */
	public String getName() {
		return this.name;
	}
	
	/**
	 * Sets the name of the quiz
	 * @param name
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * Gets the list of questions for the quiz
	 * @return
	 */
	public List<Question> getQuestions() {
		return this.questions;
	}
	
	/**
	 * Sets the list of questions for the quiz
	 * @param questions
	 */
	public void setQuestions(List<Question> questions) {
		this.questions = questions;
	}
	
	public String toString() {
		return this.getName();
	}
}
